<p>Usually the <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>
of the webserver directly relates to the URL "<code>/</code>".
But often this data is not really of top-level priority, it is
perhaps just one entity of a lot of data pools. For instance at
our Intranet sites there are <code>/e/www/</code>
(the homepage for WWW), <code>/e/sww/</code> (the homepage for
the Intranet) etc. Now because the data of the <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> stays at <code>/e/www/</code> we had
to make sure that all inlined images and other stuff inside this
<p>Note that this can also be handled using the <code class="directive"><a href="../mod/mod_alias.html#redirectmatch">RedirectMatch</a></code> directive:</p>
<div class="example"><p><code>
RedirectMatch ^/$ http://example.com/e/www/
</code></p></div>
</dd>
</dl>
<h3>Trailing Slash Problem</h3>
<dl>
<dt>Description:</dt>
<dd>
<p>Every webmaster can sing a song about the problem of
the trailing slash on URLs referencing directories. If they
are missing, the server dumps an error, because if you say
<code>/~quux/foo</code> instead of <code>/~quux/foo/</code>
then the server searches for a <em>file</em> named
<code>foo</code>. And because this file is a directory it
complains. Actually it tries to fix it itself in most of
the cases, but sometimes this mechanism need to be emulated
by you. For instance after you have done a lot of
complicated URL rewritings to CGI scripts etc.</p>
</dd>
<dt>Solution:</dt>
<dd>
<p>The solution to this subtle problem is to let the server
add the trailing slash automatically. To do this
correctly we have to use an external redirect, so the
browser correctly requests subsequent images etc. If we
only did a internal rewrite, this would only work for the
directory page, but would go wrong when any images are
included into this page with relative URLs, because the
browser would request an in-lined object. For instance, a
request for <code>image.gif</code> in
<code>/~quux/foo/index.html</code> would become
<code>/~quux/image.gif</code> without the external
<p>This is a demonstration-only example and just rewrites
all URLs <code>/~quux/foo/...</code> to
<code>/~quux/bar/...</code>. Actually you can program
whatever you like. But notice that while such maps can be
<strong>used</strong> also by an average user, only the
system administrator can <strong>define</strong> it.</p>
</dd>
</dl>
</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../en/misc/rewriteguide.html" title="English"> en </a> |
<a href="../ko/misc/rewriteguide.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</div><div id="footer">
<p class="apache">Copyright 1995-2006 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>